package aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class AspectJLogger {

	public static final String EDP = "execution(* aop.CommonEmployee.sign*(..))";
	
	@Before(EDP)
	public void logBefore(){
		
		System.out.println("logBefore：");
	}
	
	@After(EDP)
	public void logAfter(){
		
		System.out.println("logAfter：");
	}
	
//	@Around(EDP)
	public Object logAround(ProceedingJoinPoint joinPoint){
		
		System.out.println("logAround开始:");
		Object[] args = joinPoint.getArgs();
		Object obj = null;
		try {
			obj = joinPoint.proceed(args);
		} catch (Throwable e) {
			e.printStackTrace();
		}
		System.out.println("logAround结束:");
		
		return obj;
	}
}
